<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.vala</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Vala) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
<span style="color:#7a7c7d;">// Vala Sample File</span>

<span style="color:#7a7c7d;">/*</span>
<span style="color:#7a7c7d;"> * Multiline comment</span>
<span style="color:#7a7c7d;"> * </span><span style="color:#81ca2d;background-color:#4d1f24;font-weight:bold;">NOTE</span><span style="color:#7a7c7d;"> </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold;">FIXME</span><span style="color:#7a7c7d;"> </span><span style="color:#e85848;background-color:#451e1a;font-weight:bold;">ALERT</span>
<span style="color:#7a7c7d;"> */</span>
<span style="color:#2980b9;">void</span> main() {
    print(<span style="color:#f44f4f;">&quot;Hello World</span><span style="color:#3daee9;">\n</span><span style="color:#f44f4f;">&quot;</span>);
}

<span style="color:#7a7c7d;">// Example 1</span>
<span style="font-weight:bold;">class</span> Sample: Object {
    <span style="color:#2980b9;">void</span> greeting() {
        stdout.printf(<span style="color:#f44f4f;">&quot;Hello World</span><span style="color:#3daee9;">\n</span><span style="color:#f44f4f;">&quot;</span>);
    }

    <span style="font-weight:bold;">static</span> <span style="color:#2980b9;">void</span> main(<span style="color:#2980b9;">string</span>[] args) {
        <span style="color:#2980b9;">var</span> sample = <span style="font-weight:bold;">new</span> Sample();
        sample.greeting();
    }
}

<span style="color:#7a7c7d;">// Example 2</span>
<span style="font-weight:bold;">using</span> GLib;

<span style="font-weight:bold;">interface</span> Printable {
    <span style="font-weight:bold;">public</span> <span style="font-weight:bold;">abstract</span> <span style="color:#2980b9;">string</span> print();

    <span style="font-weight:bold;">public</span> <span style="font-weight:bold;">virtual</span> <span style="color:#2980b9;">string</span> pretty_print() {
        <span style="font-weight:bold;">return</span> <span style="color:#f44f4f;">&quot;Please &quot;</span> + print();
    }
}

<span style="font-weight:bold;">class</span> NormalPrint: Object, Printable {
    <span style="color:#2980b9;">string</span> print() {
        <span style="font-weight:bold;">return</span> <span style="color:#f44f4f;">&quot;don't forget about me&quot;</span>;
    }
}

<span style="font-weight:bold;">class</span> OverridePrint: Object, Printable {
    <span style="color:#2980b9;">string</span> print() {
        <span style="font-weight:bold;">return</span> <span style="color:#f44f4f;">&quot;Mind the gap&quot;</span>;
    }

    <span style="font-weight:bold;">public</span> <span style="font-weight:bold;">override</span> <span style="color:#2980b9;">string</span> pretty_print() {
        <span style="font-weight:bold;">return</span> <span style="color:#f44f4f;">&quot;Override&quot;</span>;
    }
}

<span style="color:#2980b9;">void</span> main(<span style="color:#2980b9;">string</span>[] args) {
    <span style="color:#2980b9;">var</span> normal = <span style="font-weight:bold;">new</span> NormalPrint();
    <span style="color:#2980b9;">var</span> overridden = <span style="font-weight:bold;">new</span> OverridePrint();

    print(normal.pretty_print());
    print(overridden.pretty_print());
}

<span style="color:#7a7c7d;">// Example 3</span>
<span style="font-weight:bold;">using</span> Gtk;

<span style="color:#2980b9;">int</span> main(<span style="color:#2980b9;">string</span>[] args) {
    Gtk.init(<span style="font-weight:bold;">ref</span> args);

    <span style="color:#2980b9;">var</span> window = <span style="font-weight:bold;">new</span> Window();
    window.title = <span style="color:#f44f4f;">&quot;Hello, World!&quot;</span>;
    window.border_width = <span style="color:#f67400;">10</span>;
    window.window_position = WindowPosition.CENTER;
    window.set_default_size(<span style="color:#f67400;">350</span>, <span style="color:#f67400;">70</span>);
    window.destroy.<span style="color:#0099ff;font-weight:bold;">connect</span>(Gtk.main_quit);

    <span style="color:#2980b9;">var</span> label = <span style="font-weight:bold;">new</span> Label(<span style="color:#f44f4f;">&quot;Hello, World!&quot;</span>);

    window.add(label);
    window.show_all();

    Gtk.main();
    <span style="font-weight:bold;">return</span> <span style="color:#f67400;">0</span>;
}
</pre></body></html>
